<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入标题顶部logo图片 -->
    <link rel="icon" href="../imges/logo.jpg" type="image/x-icon">
    <title>京东(JD.COM)-正品低价、品质保证</title>
    <!-- 引入登录页的css样式 -->
    <link rel="stylesheet" href="../css/login.css">
    <!-- 引入js文档 -->
    <script src="../js/jquery-3.6.0.js"></script>
    <script src="../js/ajax.js"></script>
    <script src="../js/cookie.js"></script>
</head>

<body>
    <!-- 登录顶部栏 -->
    <div class="topbar">
        <div class="leftlogin">
            <img src="../imges3/logo-201305-b.png" alt="" id="leftfigure">
            <span class="word1">欢迎登录</span>
        </div>
        <div class="rightlogin">
            <img src="../imges3/对话.png" alt="" id="rightsession">
            <a href="javascript:;" id="word2">登录页面，调查问卷</a>
        </div>
    </div>
    <!-- 隐私政策栏 -->
    <div class="privacypolicy">
        <p class="word3">⦸依据《网络安全法》，为保障您的账户安全和正常使用，请尽快完成手机号验证！ 新版《<a href="javascript:;">京东隐私政策</a>》已上线，将更有利于保护您的个人隐私。</p>
    </div>
    <!-- 登录功能栏 -->
    <div class="loginplate">
        <div class="loginbox">
            <div class="remind">
                <p class="word4">⦸京东不会以任何理由要求您转账汇款，谨防诈骗。</p>
            </div>
            <div class="account">
                <a href="" id="login1">扫码登录</a>
                <a href="" id="login2">账户登录</a>
            </div>
            <div class="Inputarea">
                <form action="" id="from1">
                    <input type="text" name="name" id="account" placeholder="   邮箱/用户名/登录手机"> <button id="btn1"><img src="../imges3/账户.png" alt="" id="img1"></button><br>
                    <input type="password" name="pwd" id="pass" placeholder="   密码"><button id="btn2"> <img src="../imges3/密码.png" alt="" id="img2"></button><br>
                    <a href="" id="forgot">忘记密码</a>
                    <div class="btn3" style="line-height: 35px;text-align: center;">登 录</div>
                </form>
            </div>
            <div class="registration">
                <div class="toway">
                    <div class="qqtoway">
                        <img src="../imges3/QQ.png" alt="" id="qqimg">
                        <a href="javascript:;" id="qqword">QQ   |  </a>
                    </div>
                    <div class="wxtoway">
                        <img src="../imges3/wx.jpg" alt="" id="wximg">
                        <a href="javascript:;" id="wxword">微信</a>
                    </div>
                </div>
                <div class="goregi">
                    <img src="../imges3/向右3.png" alt="" id="rightimg">
                    <a href="./registered.html" id="registered">立即注册</a>
                </div>
            </div>
        </div>
    </div>
    <!-- 登录顶部栏 -->
    <div class="fotbar">
        <ul id="tolist">
            <li id="list"><a href="javascript:;">关于我们 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">联系我们 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">人才招聘 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">商家入驻 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">广告服务 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">手机京东 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">友情链接 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">销售联盟 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">京东社区 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">京东公益 </a><i>|</i></li>
            <li id="list"><a href="javascript:;">English Site</a></li>
        </ul>
    </div>
    <script>
        $('.btn3').click(function() {
            // 执行函数 完成请求
            setLogin();
            return false;

        })
        async function setLogin() {
            let name = $('[name="name"]').val();
            let pwd = $('[name="pwd"]').val();
            console.log(name);
            console.log(pwd);
            const res = await myPromiseAjax('../server/goods_login.php', 'post', {
                userName: name,
                userPwd: pwd
            }, 'json')

            console.log(res);
            if (res.code === 1) {
                let num = 5;
                window.alert('恭喜您登录成功！点击确定跳转首页')
                window.location.href = './index.html';
            } else if (res.code === 0) {
                window.alert('登录失败！输入正确的账号密码')
            }
            mySetCookie('login', 1, 7 * 24 * 60 * 60, '/');
        }
    </script>
</body>

</html>